<?php 

$sessao = new Zend_Session_Namespace('Parametros');

$db = Zend_Db_Table_Abstract::getDefaultAdapter();

$result = $db->fetchAll('SELECT SQL_CACHE * FROM ST_PRODUTO WHERE PRO_STA = 1 ORDER BY RAND() LIMIT 6');
$ft_produtos = $result;

$result = $db->fetchAll('SELECT SQL_CACHE * FROM ST_PARCEIROS WHERE PCR_STA = 1 ORDER BY RAND() LIMIT 6');
$ft_parceiros = $result;


$result = $db->fetchAll('SELECT SQL_CACHE b.SER_ID,b.SER_NOM FROM ST_SERVICO b, ST_CATEGORIA_SERVICO c WHERE b.CTS_ID = c.CTS_ID AND SER_STA = 1 ORDER BY RAND() LIMIT 6');
$ft_servicos = $result;

?>

<!-- Footer -->
<div id="footer">
    <div class="container">
        <div class="row">
            
            <section class="4u">
                <header>
                    <h2><a href="<?php echo $this->urlbase.'/servicos'; ?>">Serviços</a></h2>
                </header>
                <?php 
                    $col = 1;
                    foreach($ft_servicos as $serv) { 
                        $img = glob('public/upload/stservico/'.$serv['SER_ID'].'_fot.*');
                        $img = $img[0];
                ?>
                    <?php if($col == 1){ ?>
                        <div class="row 25% no-collapse">
                    <?php } ?>
                    
                    <div class="6u">
                        <a class="image fit" href="<?php echo $this->urlbase.'/servicos/index/id/'.$serv['SER_ID']; ?>"><img src="<?php echo $this->urlbase.'/'.$img; ?>" alt="<?php echo $serv['SER_NOM']; ?>" /></a>
                    </div>
                    
                    <?php if($col == 2){ ?>
                        </div>
                    <?php } ?>
                            
                     <?php 
                        if($col == 1) $col = 2; 
                        else $col = 1; 
                     ?>      
                <?php } ?>
                <?php if($col == 2){ ?>
                    </div>
                <?php } ?>
            </section>
            
            <section class="4u">
                <header>
                    <h2><a href="<?php echo $this->urlbase.'/produtos'; ?>">Produtos</a></h2>
                </header>
                <?php 
                    $col = 1;
                    foreach($ft_produtos as $prod) { 
                        $img = glob('public/upload/stproduto/'.$prod['PRO_ID'].'_fot.*');
                        $img = $img[0];
                ?>
                    <?php if($col == 1){ ?>
                        <div class="row 25% no-collapse">
                    <?php } ?>
                    
                    <div class="6u">
                        <a class="image fit"><img src="<?php echo $this->urlbase.'/'.$img; ?>" alt="<?php echo $prod['PRO_NOM']; ?>" /></a>
                    </div>
                    
                    <?php if($col == 2){ ?>
                        </div>
                    <?php } ?>
                            
                     <?php 
                        if($col == 1) $col = 2; 
                        else $col = 1; 
                     ?>      
                <?php } ?>
                <?php if($col == 2){ ?>
                    </div>
                <?php } ?>
                
            </section>
            
            <section class="4u">
                <header>
                    <h2><a href="<?php echo $this->urlbase.'/parceiros'; ?>">Parceiros</a></h2>
                </header>
                <?php 
                    $col = 1;
                    foreach($ft_parceiros as $parc) { 
                        $img = glob('public/upload/stparceiros/'.$parc['PCR_ID'].'_fot.*');
                        $img = $img[0];
                ?>
                    <?php if($col == 1){ ?>
                        <div class="row 25% no-collapse">
                    <?php } ?>
                    
                    <div class="6u">
                        <a class="image fit"><img src="<?php echo $this->urlbase.'/'.$img; ?>" alt="<?php echo $parc['PCR_NOM']; ?>" /></a>
                    </div>
                    
                    <?php if($col == 2){ ?>
                        </div>
                    <?php } ?>
                            
                     <?php 
                        if($col == 1) $col = 2; 
                        else $col = 1; 
                     ?>      
                <?php } ?>
                <?php if($col == 2){ ?>
                    </div>
                <?php } ?>
            </section>
            
        </div>
        <hr />
        <div class="row">
            <div class="12u">

                <!-- Contact -->
                <section class="contact">
                    <header>
                        <h3>Agende um horário agora e tenha uma experiência maravilhosa!</h3>
                    </header>
                    
                    <a href="<?php echo $this->urlbase.'/agenda'; ?>" class="button">Agendar Horário</a>
                    
                    <p>Teremos o maior prazer em fazer parte da sua vida.</p>
                    
                    <ul class="icons">
                        <?php /* <li><a href="#" class="icon fa-twitter"><span class="label">Twitter</span></a></li> */?>
                        <?php if (strlen($sessao->parametros['PAR_FAC']) > 5) { ?>
                            <li><a href="http://<?php echo $sessao->parametros['PAR_FAC']; ?>" target="_blank" class="icon fa-facebook"><span class="label">Facebook</span></a></li>
                        <?php } ?>
                        <?php /* <li><a href="#" class="icon fa-instagram"><span class="label">Instagram</span></a></li>
                        <li><a href="#" class="icon fa-pinterest"><span class="label">Pinterest</span></a></li>
                        <li><a href="#" class="icon fa-dribbble"><span class="label">Dribbble</span></a></li>
                        <li><a href="#" class="icon fa-linkedin"><span class="label">Linkedin</span></a></li>*/?>
                    </ul>
                </section>
                
                <?php 
                    $db = Zend_Db_Table_Abstract::getDefaultAdapter();

                    $menusite = $db->fetchAll('SELECT SQL_CACHE * FROM ST_MENU WHERE MET_STA = 1 ORDER BY MET_ORD ASC');
                ?>
                <div class="contact">
                    <ul class="menu">
                        <?php foreach ($menusite as $menu) { ?>
                            <li><a href="<?php echo $this->urlbase.'/'.$menu['MET_LNK']; ?>"><?php echo $menu['MET_NOM']; ?></a></li>
                        <?php } ?>
                    </ul>
                </div>
                
                <!-- Copyright -->
                <div class="copyright">
                    <ul class="menu">
                        <li>&copy; Lea Casarin. Todos os direitos reservados.</li><li><a href="http://www.guapoweb.com.br" target="_blank">Guapo Web</a></li>
                    </ul>
                </div>

            </div>

        </div>
    </div>
</div>
